package com.huluobo.appbase.utils

import android.content.Context
import com.huluobo.appbase.tools.LoadingDialog
import com.huluobo.appbase.expand.defaultDialogView

/**
 * Created by lc on 2022/12/29.
 * 加载对话框工具类
 */
object DialogLoadingUtil {
    private var dialog: LoadingDialog? = null

    fun showLoading(context: Context, msg: String) {
        dialog?.apply {
            if (isShowing) {
                cancel()
            }
        }

        dialog = LoadingDialog.Builder(context).defaultDialogView().setBottomDesc(msg).create()

        dialog!!.show()
    }

    fun cancel() {
        dialog?.cancel()
    }
}